﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Test1
{
    public partial class Form02 : Form
    {
        public Form02()
        {
            InitializeComponent();
        }
        #region 实例02-01,02
        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Text = "人因梦想而伟大！\r\n\t\t——雷军";
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = "\r\n\r\n" +
                " **********************************\r\n" +
                " *\t\t\t\t  *\r\n" +
                " *北京城市学院智能电子制造研究中心*\r\n" +
                " *\t\t\t\t  *\r\n" +
                " *********************************";
        }
        #endregion

        #region 实例03-01
        private void button3_Click_1(object sender, EventArgs e)
        {
            double height = 1.20;
            int weight = 60;
            string str_bmi;
            lb_BMI.Visible = true;
            lb_bmi1.Visible = true;

            height = Convert.ToDouble(tb_th.Text);
            weight = Convert.ToInt32(tb_wh.Text);
            double bmi = weight / (height * height);
            str_bmi = bmi.ToString();
            lb_BMI.Text = str_bmi;
            if (bmi < 18.5)
            {
                lb_bmi1.Text = "体重过轻";

            }
            else if (bmi >= 18.5 && bmi < 24.9)
            {
                lb_bmi1.Text = "正常范围";
            }
            else if (bmi >= 24.9 && bmi < 29.9)
            {
                lb_bmi1.Text = "体重过重";
            }
            else if (bmi >= 19.9)
            {
                lb_bmi1.Text = "肥胖症";
            }
        }
        #endregion

        #region 实例03-2,3
        private void button4_Click_1(object sender, EventArgs e)
        {
            char a = 'a';
            char b = 'B';
            char c = 'L';
            char d = '.';
            textBox1.Text = "IsLetter方法判断a是否为字母：" + char.IsLetter(a) +
                "\r\nIsDight方法判断b是否为字母：" + char.IsDigit(b) +
                "\r\nIsLetterOrDight方法判断c是否为字母：" + char.IsLetterOrDigit(c) +
                "\r\nIsLower方法判断a是否为字母：" + char.IsLower(a) +
                "\r\nIsUpper方法判断c是否为字母：" + char.IsUpper(c) +
                "\r\nIsPunctuation方法判断d是否为字母：" + char.IsPunctuation(d) +
                "\r\nIsSeparator方法判断e是否为字母：" + char.IsSeparator('|') +
                "\r\nIsWhiteSpare方法判断f是否为字母：" + char.IsWhiteSpace(' ');
        }
        private void button5_Click_1(object sender, EventArgs e)
        {
            textBox1.Text = "windows系统目录为：C:\\Windows";
        }
        #endregion
    }
}
